import {Actor, Action, IMap} from 'plume2'
export default class EditorActor extends Actor {
    defaultState() {
        return {
            id:"",
            bannerImage:"",
            tplImage:"",
            activated:false,
            _height:"",
            content:"",
            SelectId:"",
            index:""
        }
    }

    @Action('tpl:bannerImage')
    getEditorList(state: IMap, {url}) {
        return state.setIn(["editor","bannerImage"], url);
    }

    @Action('tpl:tplImage')
    getTemplateList(state: IMap, {url,id, activated,height,content,index}) {
        console.log(url,id, activated,height);
        return state.setIn(["editor","tplImage"], url)
                     .setIn(["editor","id"], id)
                     .setIn(["editor","activated"], activated)
                     .setIn(["editor","_height"],height)
                     .setIn(["editor","content"],content)
                     .setIn(["editor","index"],index)
    }

    @Action('tpl:SelectId')
    getSelectId(state: IMap, SelectId) {
        return state.setIn(["editor","SelectId"], SelectId);
    }
    @Action('tpl:SelectBannerImage')
    SelectBannerImage(state: IMap, content) {
        return state.setIn(["editor","content"], content);
    }
}